/*
 *  Cero Project - Copyright   2006 The Cero Developement Team 
 *  (Michael Laguerre, Camille Roux, Matthieu Segret, Mathieu Sivade) 
 * 
 *  This program is free software; you can redistribute it and/or modify it 
 *  under the terms of the GNU General Public License as published by the Free 
 *  Software Foundation; either version 2 of the License, or (at your option) 
 *  any later version.
 * 
 *  This program is distributed in the hope that it will be useful, but 
 *  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
 *  or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 
 *  for more details.
 */

package org.ceroproject.ui;

import org.ceroproject.games.Game;

/**
 * Defines an interface plugin. Depending on the type of interfaces it can plug
 * into, its implementation may vary. It might as well be a panel for a graphic
 * interface as a command for a command line interface.
 * 
 * @author Telem
 */
public interface InterfaceModule {
	/**
	 * Turns the plugin on, internally speaking. Implement this function to do
	 * optional treatment at plugin activation. (Like adding listeners to the
	 * game, and such). This method is called before actual activation.
	 */
	void onActivate();

	/**
	 * Turns the plugin off, internally speaking. Implement this function to do
	 * optional treatment at plugin desactivation. (Like removing listeners,
	 * free resources and such). This method is called after actual
	 * desactivation.
	 */
	void onDesactivated();

	/**
	 * Returns the type of interface this module applies to (cannot be null)
	 * 
	 * @return The Class of the interface this module applies to
	 */
	Class<? extends UserInterface> appliesToInterface();

	/**
	 * Returns the type of game this module applies to
	 * 
	 * @return The Class of the game this module applies to (may be null if any
	 *         game fits)
	 */
	Class<? extends Game> appliesToGame();

	/**
	 * Returns the name of the interface module
	 * 
	 * @return the name of the interface module
	 */
	String getInterfaceModuleName();
}
